import Router from 'koa-router';
import proxyService from '../../common/proxyService';
import {
  getSmartFormList,
  getFormInfoByPage,
  getFormHeader,
  deleteFrFormInfoForm,
  copyFrFormInfo,
  getTemplateFormList,
  getStatisticsSurvey,
  updateVerification,
  getFormInfo,
  getIsStatistics,
  getSmartFormInfo,
  getTemplateFormPage,
} from '../../api';
const router = new Router();
// 表单数据列表
router.post('/getSmartFormList', async ctx => {
  const response = await proxyService.postProxy(ctx, getSmartFormList);
  return (ctx.body = response);
});

// 获取表单列表
router.post('/getFormInfoByPage', async ctx => {
  const response = await proxyService.postProxy(ctx, getFormInfoByPage);
  return (ctx.body = response);
});

// 获取表单详情
router.get('/getSmartFormInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getSmartFormInfo);
  return (ctx.body = response);
});
// 分页获取模板表单列表
router.get('/getTemplateFormPage', async ctx => {
  const response = await proxyService.postProxy(ctx, getTemplateFormPage);
  return (ctx.body = response);
});
// 获取表头信息或者获取筛选信息
router.get('/getFormHeader', async ctx => {
  const response = await proxyService.postProxy(ctx, getFormHeader);
  return (ctx.body = response);
});

// 删除表单
router.get('/deleteFrFormInfoForm', async ctx => {
  const response = await proxyService.postProxy(ctx, deleteFrFormInfoForm);
  return (ctx.body = response);
});

// 复制表单
router.get('/copyFrFormInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, copyFrFormInfo);
  return (ctx.body = response);
});

// 获取模板表单列表
router.get('/getTemplateFormList', async ctx => {
  const response = await proxyService.postProxy(ctx, getTemplateFormList);
  return (ctx.body = response);
});

// 表单统计概况
router.get('/getStatisticsSurvey', async ctx => {
  const response = await proxyService.postProxy(ctx, getStatisticsSurvey);
  return (ctx.body = response);
});

// 表单数据核销
router.get('/updateVerification', async ctx => {
  const response = await proxyService.postProxy(ctx, updateVerification);
  return (ctx.body = response);
});

// 获取表单详情
router.get('/getFormInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getFormInfo);
  return (ctx.body = response);
});

// 获取是否开启裂变
router.get('/getIsStatistics', async ctx => {
  const response = await proxyService.postProxy(ctx, getIsStatistics);
  return (ctx.body = response);
});

export default router;
